Skip to content

Update PgBouncer guidance and expand integration coverage#2603

Open
achanda wants to merge 1 commit into
jackc:masterfrom
achanda:expand-pgbouncer-tests
Open

Update PgBouncer guidance and expand integration coverage#2603
achanda wants to merge 1 commit into
jackc:masterfrom
achanda:expand-pgbouncer-tests

Conversation

@achanda

@achanda achanda commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Document prepared statement support in PgBouncer 1.21+ and test all compatible query execution modes, including parameterized queries, transactions, Exec, and batches. Also enable pgbouncer tests in CI.

@achanda
achanda force-pushed the expand-pgbouncer-tests branch 4 times, most recently from a34d2b5 to 83c7e2e Compare July 20, 2026 02:15
@jackc

jackc commented Jul 25, 2026

Copy link
Copy Markdown
Owner

There are a few suggestions from Claude that made sense to me:


  1. The new CI job runs the entire suite for two tests. ci.yml:157 is go test -parallel=1 -race -count=1 -v ./..., which duplicates the existing PG18/Go1.26 matrix job in full (~2 min of pgconn + ~36 s of pgproto3 alone here) and -v dumps the whole suite's output. Only TestPgbouncerQueryExecModes and TestConnContextCanceledCancelsRunningQueryOnServer consume PGX_TEST_PGBOUNCER_CONN_STRING. Narrowing to -run 'TestPgbouncer|TestConnContextCanceledCancelsRunningQueryOnServer' ./... and dropping -v cuts the job to well under a minute.

  2. The 39-line source build is unnecessary. PGDG publishes pgbouncer 1.25.2-1.pgdg22.04+1 for jammy — I confirmed it's in the jammy-pgdg package index — and ci/setup_test.bash has already added that repo by the time setup_pgbouncer.bash runs. So the download, sha256 pin, build-essential/libevent-dev/libssl-dev install, and ./configure && make collapse to sudo apt-get install -y pgbouncer, and there's no pinned hash to bump on every PgBouncer release.

  3. Coverage gap the PR could cheaply close. With StatementCacheCapacity: 32 and only ~5 distinct SQL strings, the cache never evicts, so pgx's protocol-level Close path (conn.go:1457) is never exercised through PgBouncer — arguably the most likely thing to break now that the docs recommend the default mode with PgBouncer. I tested it separately (capacity 8, 200 distinct statements) and it passes, so this is a coverage suggestion, not a defect.

@achanda
achanda force-pushed the expand-pgbouncer-tests branch from 83c7e2e to 3275fab Compare July 25, 2026 23:04
@achanda

achanda commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review, makes sense to me. Pushed an update with all suggested fixes.

@achanda
achanda force-pushed the expand-pgbouncer-tests branch from 3275fab to 6091372 Compare July 25, 2026 23:06
Document prepared statement support in PgBouncer 1.21+ and test
all compatible query execution modes, including parameterized
queries, transactions, Exec, and batches. Also enable pgbouncer
tests in CI.
@achanda
achanda force-pushed the expand-pgbouncer-tests branch from 6091372 to bba4ef4 Compare July 26, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants